<?php

namespace privateClass\App;

class Client {
	function __construct() {
		if (!isset($_SESSION)) session_start();
	}
	
	public function set() {
		$result = FALSE;
		$result['AMSCID'] = hash('sha256', session_id());
		setcookie('AMSCID',$result['AMSCID'], 2147483647);
		return $result;
	}
	
	public function get($_query_string_amscid = NULL) {
		$result['AMSCID'] = !empty($_query_string_amscid) ? $_query_string_amscid : (isset($_COOKIE['AMSCID']) ? $_COOKIE['AMSCID'] : FALSE);
		if ($result['AMSCID'] == FALSE) $result = $this->set();
		\Yaf\Registry::set('AMSCID',$result['AMSCID']);
		return $result;
	}
	
	function __destruct() {
	}
}

?>